
            Object.prototype.querySerialize = function (prefix) {
                var result = [];
                for (var key in this) {
                    if (this.hasOwnProperty(key)) {
                        var value = this[key];
                        if (value instanceof Array || value instanceof Object) {
                            result.push(value.querySerialize(prefix ? prefix + '[' + key + ']' : key));
                        } else {
                            result.push((prefix ? prefix + '[' + key + ']' : key) + '=' + encodeURIComponent(value));
                        }
                    }
                }

                return result.join('&');
            };
            Array.prototype.querySerialize = function (prefix) {
                var result = [];
                this.forEach(function (o, i) {
                    if (o instanceof Array || o instanceof Object) {
                        result.push(o.querySerialize(prefix + '[' + i + ']'))
                    } else {
                        result.push(prefix + '[' + i + ']=' + encodeURIComponent(o));
                    }
                });

                return result.join('&');
            };